<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>内部用户管理</title>
<link rel="stylesheet" href="resources/static/css/pintuer.css">
<link rel="stylesheet" href="resources/static/css/admin.css">
<script src="resources/static/js/jquery.js"></script>
<script src="resources/static/js/pintuer.js"></script>

<script type="text/javascript">
	//跳转到新增页面
	function toaddUser() {
		window.location.href = 'viewjsp/inuser/addUser.jsp';
	}
	//上一页
	function upPage() {
		if (${pages.currentPage} == 1){
			
		}else{
		$("#upPage").attr("href", "user/list?page=" + (${pages.currentPage} - 1));
		}
	}

	//下一页
	function nextPage(){
		if (${pages.currentPage} == ${pages.totalPages}){
			
		}else{
		$("#nextPage").attr("href","user/list?page=" + (${pages.currentPage} + 1));
		}
	}
	
	//首页
	function head(){
		$("#head").attr("href", "user/list?page=1");
	}
	
	//末页
	function last(){
		$("#last").attr("href", "user/list?page=" + ${pages.totalPages});			
	}
	
	

</script>
</head>
<body>
	<div class="panel admin-panel">
		<div class="panel-head">
			<strong class="icon-reorder">内部用户互动管理</strong>
		</div>
		<div class="padding border-bottom clearfix">
			<form method="post" class="form-x uI" id="search" name="search"
				action="user/selUser">
				<div class="form-group form-group2">
					<div class="label" style="width: 120px;">
						<label>账号：</label>
					</div>
					<div class="field" style="width: 70%;">
						<input type="text" class="input w50" id="username" name="username" />
					</div>
				</div>
				<div class="form-group form-group2">
					<div class="label" style="width: 120px;">
						<label>单位：</label>
					</div>
					<div class="field" style="width: 70%;">
						<input type="text" class="input w50" id="unit" name="unit" />
					</div>
				</div>
				<div class="form-group form-group2">
					<div class="label" style="width: 120px;">
						<label>手机号：</label>
					</div>
					<div class="field" style="width: 70%;">
						<input type="text" class="input w50" id="phonenum" name="phonenum" />
					</div>
				</div>
				<div class="form-group form-group2">
					<div class="label" style="width: 120px;">
						<label>邮箱：</label>
					</div>
					<div class="field" style="width: 70%;">
						<input type="text" class="input w50" id="mailbox" name="mailbox" />
					</div>
				</div>
				<div class="form-group form-group2">
					<div class="label" style="width: 120px;">
						<label>状态</label>
					</div>
					<div class="field" style="width: 70%;">
						<select class="input w50" data-validate="required:状态">
							<option value="三个月">正常</option>
							<option value="一年">已注销</option>
						</select>
					</div>
				</div>
				<div class="form-group form-group2">
					<div class="label">
						<label></label>
					</div>
					<div class="field">
						<button class="button bg-main"
							style="float: right; padding: 10px 50px; margin-right: 150px;"
							type="submit">搜索</button>
					</div>
				</div>
			</form>
		</div>
		<div class="padding border-bottom">
			<button type="button" class="button border-blue"
				onClick="toaddUser()">
				<span class="icon-plus-square-o"></span> 添加用户
			</button>
		</div>
		<table class="table table-hover text-center" id="usertable">
			<tr>
				<th width="">序号</th>
				<th width="">姓名</th>
				<th width="">单位</th>
				<th width="">手机号</th>
				<th width="">邮箱</th>
				<th width="">职务</th>
				<th width="">状态</th>
				<th width="">操作</th>
			</tr>
			<c:forEach items="${userlist}" var="userlist" varStatus="status">
				<tr>
					<td>${status.index+1}</td>
					<td>${userlist.name}</td>
					<td>${userlist.unit}</td>
					<td>${userlist.phonenum}</td>
					<td>${userlist.mailbox}</td>
					<td>${userlist.job}</td>
					<td>${userlist.status}</td>
					<td><c:choose>
							<c:when test="${userlist.status eq 1}">
								<div class="button-group" id="zx" name="zx_hf">
									<a class="button border-red"
										href="user/upStatus?userid=${userlist.userid}"><span
										class="icon-trash-o"></span> 注销 </a> <a class="button border-main"
										href="record/recordList" target="right"><span
										class="icon-edit">操作记录</span></a> <a class="button border-green"
										href="user/toUpUser?userid=${userlist.userid}" target="right"><span
										class="icon-edit"></span>修改</a>
								</div>
							</c:when>
							<c:when test="${userlist.status eq 2}">
								<div class="button-group" id="hf" name="zx_hf">
									<a class="button border-yellow"
										href="user/upStatus?userid=${userlist.userid}" target="right"><span
										class="icon-edit"></span>恢复</a>
								</div>
							</c:when>
						</c:choose></td>
				</tr>
			</c:forEach>
			<tr>
				<td colspan="8">
					<div class="pagelist">
						<span class="fl pl10">共检测到${pages.count }条记录</span> <span
							class="pr10"> <a id="head" onclick="head()">首页</a> <a
							id="upPage" onclick="upPage()">上一页</a> <c:forEach var="i"
								begin="1" end="${pages.totalPages }" step="1">
								<a href="user/list?page=${i}">${i}</a>
							</c:forEach> <a id="nextPage" onclick="nextPage()">下一页</a> <a id="last"
							onclick="last()">尾页</a>
						</span>
					</div>
				</td>
			</tr>

		</table>
	</div>
</body>
</html>